#include <cstdio>

using namespace std;

typedef long long ll;
const int maxn=2000000, mods=1000000007, inv2=(mods+1)/2;
int n, son[maxn+1], bro[maxn+1], fa[maxn+1];
ll fact[maxn+1], invf[maxn+1];

void read(int &ret) {
    ret=0;
    char c;
    for (c=getchar(); c<'0' || c>'9'; c=getchar());
    for (; c>='0' && c<='9'; c=getchar()) ret = ret*10+c-'0';
}

ll qpower(ll a, int n) {
    ll s=1;
    for (; n; n/=2) {
        if (n&1) s=s*a%mods;
        a = a*a%mods;
    }
    return s;
}

void initFact(int n) {
    fact[0] = 1;
    for (int i=1; i<=n; i++) fact[i] = fact[i-1]*i%mods;
    invf[n] = qpower(fact[n], mods-2);
    for (int i=n; i>0; i--) invf[i-1] = invf[i]*i%mods;
}

ll inv(int x) {return invf[x]*fact[x-1]%mods;}

void addSide(int f, int s) {
    fa[s] = f;
    bro[s] = son[f];
    son[f] = s;
}

ll solve() {
    static int que[maxn+1][2], h=0, t=1;
    static ll sum[maxn+1];
    que[1][0] = 1, que[1][1] = 0;
    ll ret=0;
    for (; h<t;) {
        int o=que[++h][0];
        if (que[h][1]>0) sum[o] = (sum[o]+inv(que[h][1]))%mods;
        ret = (ret+sum[o])%mods;
        for (int i=son[o]; i; i=bro[i]) {
            sum[i] = sum[o];
            que[++t][0] = i;
            que[t][1] = que[h][1]+1;
        }
    }
    return ret;
}

int main() {
    freopen("deconstruct.in", "r", stdin);
    freopen("deconstruct.out", "w", stdout);

    read(n);
    initFact(n);
    for (int i=2; i<=n; i++) {
        int f;
        read(f);
        addSide(f, i);
    }
    printf("%lld\n", solve());

    fclose(stdin);
    fclose(stdout);
    return 0;
}
